-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Under Miri, disable debug asserts for things Miri always checks #101079
Conversation
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
r? @ghost |
@rustbot author |
30d6ce8
to
680f167
Compare
This comment has been minimized.
This comment has been minimized.
680f167
to
388dd8b
Compare
☔ The latest upstream changes (presumably #100759) made this pull request unmergeable. Please resolve the merge conflicts. |
388dd8b
to
3ea7fa3
Compare
3ea7fa3
to
da79af7
Compare
☔ The latest upstream changes (presumably #103562) made this pull request unmergeable. Please resolve the merge conflicts. |
da79af7
to
7710d6c
Compare
☔ The latest upstream changes (presumably #103623) made this pull request unmergeable. Please resolve the merge conflicts. |
7710d6c
to
80b6a04
Compare
I'm not sure the magnitude of the effect here is worth the complexity of implementation. Maybe if we had a different implementation strategy it might make sense, but the scary heavyweight debug assertions for container invariants aren't/can't be covered by this strategy. |
Context: rust-lang/miri#2497, Miri currently disables debug assertions in the standard library out of concern for how much slower code runs under Miri. A significant contributor there are these checks, which are entirely redundant and occur before Miri's, resulting in a much worse user experience if they are actually hit. So there is no reason to have them enabled under Miri.
However, this leaves some checks still enabled. Most notably, the bounds check(s) on
slice::get_unchecked
is staying put. This precondition originates in the requirements of Stacked Borrows, which can be disabled, and also has nothing to say about ZSTs, where the library API forbids out-of-bounds indexing, even for ZSTs.